package com.wuyou.simple;

/**
 * 2180. 统计各位数字之和为偶数的整数个数
 */
public class CountEven {


    public static void main(String[] args) {
//        int num = 519;
        int num = 30;

        System.out.println(solution_1(num));
    }

    public static int solution_1(int num) {
        int a = num / 10;
        int b = num % 10;
        int res = a * 5;
        int sum = 0;
        while (a != 0) {
            sum += a % 10;
            a /= 10;
        }
        if (sum % 2 == 0) {
            res += b / 2 + 1;
        } else {
            res += (b + 1) / 2;
        }
        return res - 1;
    }
}
